﻿<div class="module-container">
    <div class="search-panel">
        <form class="form-inline search-table">
            <div class="form-group">
                <input class="form-control w200px" name="key" type="text"
                       placeholder="请输入标题查询">
            </div>
            <div class="form-group">
                <select class="form-control uiselect uiselectsubmit" name="Status"
                        data-has-text-field="false">
                    @Html.EmptyOption("全部状态")
                    <option value="true">已审核</option>
                    <option value="false">待审核</option>
                </select>
            </div>
            
            <div class="form-group">
                <div id="categorys" type="selectTree" class="ui-select w200px"></div>
                <input type="hidden" name="@nameof(Model.CategoryId)" id="CategoryIds" />
            </div>

            <div class="form-group">
                <div class="input-group date w165px uidate">
                    <input class="form-control" name="startDate" type="text" placeholder="请选择开始日期">
                    <span class="input-group-addon">
                        <i class="glyphicon glyphicon-th"></i>
                    </span>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group date w165px uidate">
                    <input class="form-control" name="endDate" type="text" placeholder="请选择结束日期">
                    <span class="input-group-addon">
                        <i class="glyphicon glyphicon-th"></i>
                    </span>
                </div>
            </div>

            <button class="btn btn-primary" type="submit">
                <i class="fa fa-search"></i> 查询
            </button>

            <a class="btn btn-success uimodal" data-size="lg" data-url="@Url.Action("Create")">
                <i class="fa fa-plus"></i> 新建
            </a>

            <a class="btn btn-danger tmdelete" data-table=".uitable" data-url="@Url.Action("Delete")">
                <i class="fa fa-trash-o"></i> 删除
            </a>

            <a class="btn btn-default" id="article_export" data-url="@Url.Action("Export")">
                <i class="fa fa-share-square-o"></i> 导出
            </a>

        </form>
    </div>
    <div class="uitable" data-url="@Url.Action("Grid")">
        @Html.Action("Grid")
    </div>
</div>

<script>

    $('#article_export').on('click', function () {
        var url = $(this).data('url') + '?' + $.param(fx.serializeForm($('.search-table')));
        window.location.href = url;
    });

    $("#categorys").ComboBoxTree({
        url: "@Url.Action("GetTreeJson")",
        description: "请选择分类",
        height: "200px",
        allowSearch: true,
    }).bind("change", function () {
        var value = $(this).attr('data-value');
        var text = $(this).attr('data-text');
        $('#CategoryIds').val(value);
    });
    
</script>